package com.ruoyi.project.im.personhost.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.im.personhost.mapper.PersonhostMapper;
import com.ruoyi.project.im.personhost.domain.Personhost;
import com.ruoyi.project.im.personhost.service.IPersonhostService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 域名分配列表Service业务层处理
 *
 * @author ruoyi
 * @date 2022-09-11
 */
@Service
public class PersonhostServiceImpl implements IPersonhostService
{
    @Autowired
    private PersonhostMapper personhostMapper;

    /**
     * 查询域名分配列表
     *
     * @param id 域名分配列表主键
     * @return 域名分配列表
     */
    @Override
    public Personhost selectPersonhostById(Long id)
    {
        return personhostMapper.selectPersonhostById(id);
    }

    @Override
    public Personhost selectPersonhostByGroupId(String groupId){
        return personhostMapper.selectPersonhostByGroupId(groupId);
    }

    @Override
    public Personhost selectPersonhostByShortcode(String shorcode) {
        return personhostMapper.selectPersonhostByShortcode(shorcode);
    }

    @Override
    public Personhost selectPersonhostByUrl(String code) {
        return personhostMapper.selectPersonhostByUrl(code);
    }

    /**
     * 查询域名分配列表列表
     *
     * @param personhost 域名分配列表
     * @return 域名分配列表
     */
    @Override
    public List<Personhost> selectPersonhostList(Personhost personhost)
    {
        return personhostMapper.selectPersonhostList(personhost);
    }

    /**
     * 新增域名分配列表
     *
     * @param personhost 域名分配列表
     * @return 结果
     */
    @Override
    public int insertPersonhost(Personhost personhost)
    {
        personhost.setCreateTime(DateUtils.getNowDate());
        return personhostMapper.insertPersonhost(personhost);
    }

    /**
     * 修改域名分配列表
     *
     * @param personhost 域名分配列表
     * @return 结果
     */
    @Override
    public int updatePersonhost(Personhost personhost)
    {
        personhost.setUpdateTime(DateUtils.getNowDate());
        return personhostMapper.updatePersonhost(personhost);
    }

    /**
     * 批量删除域名分配列表
     *
     * @param ids 需要删除的域名分配列表主键
     * @return 结果
     */
    @Override
    public int deletePersonhostByIds(String ids)
    {
        return personhostMapper.deletePersonhostByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除域名分配列表信息
     *
     * @param id 域名分配列表主键
     * @return 结果
     */
    @Override
    public int deletePersonhostById(Long id)
    {
        return personhostMapper.deletePersonhostById(id);
    }


    @Override
    public List<Personhost> getLine(String userId) {
        return personhostMapper.getLine(userId);
    }

    @Override
    public Personhost selectPersonhostByCodeAndType(String code) {
        return personhostMapper.selectPersonhostByCodeAndType(code);
    }

    @Override
    public Personhost selectPersonhostByLuodi(String userId) {
        return personhostMapper.selectPersonhostByLuodi(userId);
    }

    @Override
    public List<Personhost> selectListByDoyuming(Long leixing, String doyuming) {
        return personhostMapper.selectListByDoyuming(leixing,doyuming);
    }
}
